import { type NextRequest } from 'next/server';

export function GET(request: NextRequest) {
	const searchParams = request.nextUrl.searchParams;
	const query = searchParams.get('query');
	console.log(searchParams);

	// query is "hello" for /api/search?query=hello
	return new Response(
		JSON.stringify({
			message: `Hello from the API in ${query}`,
			data: query
		}),
		{
			status: 200,
			headers: {
				'Content-Type': 'application/json'
			}
		}
	);
}
